import {request} from '../../utils/http'

Page({
  data: {
    order_id:''
  },
  getOrderInfo(id){
    request(`/order/show_ecrypt`, 'get', {
      order_id:id
    }).then(res => {
      console.log(res, 'order info')
      if (res.code == 200) {
        let info = res.data;
        my.navigateTo({ 
          url: `/pages/orderResult/orderResult?status=${info.status}&order_id=${this.data.order_id}&shop_id=${res.data.shop_id}`
        })

      }
    })

  },
  
  onLoad() {
    let options = my.getEnterOptionsSync();
    
    if (options.query && options.query.order_id) {
      this.getOrderInfo(options.query.order_id)
      this.setData({
        order_id:options.query.order_id
      })
    }
  },
});
